/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package slisfx.screens;




import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import slisfx.Globals;
import slisfx.resources.Load;

/**
 *
 * @author Justin Robinson
 */
public class AdminScreenViewFX extends Application implements Globals  {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override
    public void start(final Stage primaryStage) {
        try {
            primaryStage.setTitle("Welcome to NASA SLIS - ADMIN");
            primaryStage.setResizable(false);
            
            /*
             * Here we will declare all the functions for our Screen.
             */
            
            /*
             *THIS IS THE CORRECT WAY TO CALL AN IMAGE FROM A PACKAGE
             *VERY EASY UNLIKE EVERY FOURM SAYS!
             */
            
            Image image = new Image(new Load().loadFile("Stars.png"));
            Image image1 = new Image(new Load().loadFile("NASA_IVV1.png"));
            
            
            //This is our main layout function.
            BorderPane mainWindow = new BorderPane();
            mainWindow.setTop(new Rectangle(830, 50, Color.BLACK));
            mainWindow.setBottom(new Rectangle(830, 50, Color.BLACK));
            mainWindow.setLeft(new Rectangle(50, 350, Color.BLACK));
            mainWindow.setRight(new Rectangle(50, 350, Color.BLACK));
            
            //This is for the background
            StackPane stackPane = new StackPane();
            
            //This is our vertical menu
            VBox mainMenu = new VBox();
            mainMenu.setPadding(new Insets(10, 10, 10, 10));
            mainMenu.setSpacing(10);
            
            //This is for horizantal layout.
            HBox imageBox = new HBox();
            imageBox.setPadding(new Insets(10, 10, 10, 150));
            imageBox.setSpacing(100);
            
            //This is a function for Images
            ImageView iv1BackGround = new ImageView();
            ImageView iv2 = new ImageView();
            iv1BackGround.setImage(image);
            iv2.setImage(image1);
                   
            
            //Buttons our defined.
            Button btn = new Button();
            Button btn1 = new Button();
            Button btn2 = new Button();
            Button btn3 = new Button();
            
            btn.setText("Devices");
            btn.setOnAction(new EventHandler<ActionEvent>(){
            
                @Override
                public void handle(ActionEvent event){
                   //Send to DevicesViewFX
                    new DeviceViewFX().start(primaryStage);
                }
            });
            btn1.setText("Device Options");
            btn1.setOnAction(new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    //Send to DeviceOptionsViewFX.java
                    new DeviceOptionsViewFX().start(primaryStage);
                   
                }
            });
            /*This function sets up button 2 which sends
             * the user to the SystemView Screen.
             */
            btn2.setText("System Options");
            btn2.setOnAction(new EventHandler<ActionEvent>(){
                
                @Override
                public void handle(ActionEvent event){
                    new SystemViewFX().start(primaryStage);
                }
                
            });
            btn3.setText("Log out");
            btn3.setOnAction(new EventHandler<ActionEvent>(){
                
                @Override
                public void handle(ActionEvent event){
                    new LoginScreenFX().start(primaryStage);
                }
                
            });

           
           /*
            *This is where everything is called.  Will further comment 
            * at a later date.
            */

            
            imageBox.getChildren().add(iv2);
            
            Text title = new Text("Choose from the options below");
            title.setFont(Font.font("Amble CN", FontWeight.BOLD, 14));
            title.setFill(Color.WHITE);
            mainMenu.getChildren().add(title);
            mainMenu.getChildren().add(imageBox);
            
            mainMenu.getChildren().add(btn);
            mainMenu.getChildren().add(btn1);
            mainMenu.getChildren().add(btn2);
            mainMenu.getChildren().add(btn3);

            stackPane.getChildren().addAll(iv1BackGround, mainMenu);
            mainWindow.setCenter(stackPane);

            /*Sets the screen size and displays*/
            primaryStage.setScene(new Scene(mainWindow, WIDTH, HEIGHT));
            primaryStage.show();
        } catch (IOException ex) {
            Logger.getLogger(AdminScreenViewFX.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
